import { defineStore } from 'pinia'
import type { IGoods } from '@/types/home'
export const categoryListStore = defineStore('categoryList', {
    state() {
        return {
            categoryList: [],
        }
    },
    actions: {
        saveCategoryList(data: any) {
            this.categoryList = data
        },
    },
    getters: {
        category(): Array<IGoods> {
            return this.categoryList
        },
    },
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'categoryList', //设置存储的key
                storage: localStorage, //表示存储在localStorage
            },
        ],
    },
})